<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
  
  <head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" th:href="@{/pages/favicon.ico}" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" th:href="@{/pages/css/font.css}" href="./css/font.css">
    <link rel="stylesheet" th:href="@{/pages/css/xadmin.css}" href="./css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="./lib/layui/layui.js" th:src="@{/pages/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/pages/js/xadmin.js}" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a><cite>用户列表</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" th:action="@{/manage/member/toList}" method="post">
          <!--<input class="layui-input" placeholder="开始日" name="start" id="start">
          <input class="layui-input" placeholder="截止日" name="end" id="end">-->
          <input type="hidden" name="pageNum" value="0"/>
          <input type="text" name="email"  placeholder="请输入邮箱" autocomplete="off" class="layui-input" th:value="${query.email}">
          <input type="text" name="nickName"  placeholder="请输入昵称" autocomplete="off" class="layui-input" th:value="${query.nickName}">
          <button class="layui-btn" lay-submit=""  lay-filter="sreach" onclick="formSubmit();"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <xblock>
        <span class="x-right" style="line-height:40px">共有数据：<span th:text="${memberPageInfo.total}"></span> 条</span>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>
            <th>邮箱</th>
            <th>昵称</th>
            <th>注册时间</th>
            <th>性别</th>
            <th>QQ</th>
            <th>支付宝账号</th>
            <th>收款人姓名</th>
            </tr>
        </thead>
        <tbody>
          <tr th:each="member:${memberPageInfo.list}">
            <td>
              <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>
            </td>
            <td th:text="${member?.email}"></td>
            <td th:text="${member?.nickName}"></td>
            <td th:text="${#dates.format(member?.registerTime,'yyyy-MM-dd HH:mm:ss')}"></td>
            <td th:text="${member?.sex=='0'?'女':'男' }"></td>
            <td th:text="${member?.qq }"></td>
            <td th:text="${member?.alipayAccount }"></td>
            <td th:text="${member?.alipayName }"></td>
          </tr>
        </tbody>
      </table>
      <div class="page" id="page">

      </div>

    </div>
    <script th:inline="javascript">
      var pageNum = [[${memberPageInfo.pageNum}]];
      var totalNum = [[${memberPageInfo.total}]];

      layui.use('laydate', function(){
        var laydate = layui.laydate;
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
      });

       /*用户-停用*/
      function member_stop(obj,id){
          layer.confirm('确认要停用吗？',function(index){

              if($(obj).attr('title')=='启用'){

                //发异步把用户状态进行更改
                $(obj).attr('title','停用')
                $(obj).find('i').html('&#xe62f;');

                $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
                layer.msg('已停用!',{icon: 5,time:1000});

              }else{
                $(obj).attr('title','启用')
                $(obj).find('i').html('&#xe601;');

                $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
                layer.msg('已启用!',{icon: 5,time:1000});
              }
              
          });
      }

      /*删除*/
      function article_del(obj){
          layer.confirm('确认要删除吗？',function(index){
              //发异步删除数据
              var aid = $(obj).attr("aid");
              $.post("/article/delete?id="+aid,"",function (result,status,jqxhr) {
                  if(jqxhr.status==200){
                      layer.msg(result,{icon:1,time:1000},function () {
                          $("form").submit();
                      });
                  }else{
                      layer.msg(result,{icon:2,time:1000});
                  }
              });

          });
      }



      function delAll (argument) {

        var data = tableCheck.getData();
  
        layer.confirm('确认要删除吗？'+data,function(index){
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
            $(".layui-form-checked").not('.header').parents('tr').remove();
        });
      }

      function openDetail(title,obj,url) {
          var aid = $(obj).attr("aid");
          url = url+"?id="+aid;
          var w=($(window).width()*0.9);
          var h=($(window).height() - 50);
          layer.open({
              type: 2,
              area: [w+'px', h +'px'],
              fix: false, //不固定
              maxmin: true,
              shadeClose: true,
              shade:0.4,
              title: title,
              content: url
          });
      }


      layui.use('laypage', function(){
          var laypage = layui.laypage;

          //执行一个laypage实例
          laypage.render({
              elem: 'page',
              curr:pageNum,
              count:totalNum,
              limit:10,
              jump:function (obj,first) {
                  console.log(obj.curr);
                  $("input[name='pageNum']").val(obj.curr);
                  if(!first) {
                      $("form").submit();
                  }
              }
          });
      });

      function formSubmit() {
          $("input[name='pageNum']").val(0);
      }
    </script>
  </body>

</html>